// 存取器，通过getters 和 setters 来截取对1对象成员的访问，
// 可以有效地控制对对象成员的访问
(() =>{
let passcode = '10086'
class Employee{
    private _fullname:string
    get fullName():string{
        console.log('访问了fullName');
        
        return this._fullname
    }
    set fullName(newName:string){
        if(passcode && passcode === '10086'){
            console.log('修改名字');
            this._fullname = newName
        }else{
            console.log('无权修改名字');
        }
    }
}
const employee = new Employee()
employee.fullName = '小小'
console.log(employee.fullName);

})()